home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / bin / amuFormat.sh < prev    next >
Encoding:
Linux/UNIX/POSIX Shell Script  |  2008-05-29  |  1.9 KB  |  88 lines

  1. #!/bin/sh
  2. #
  3. #  amuFormat.sh  Formats various types and sizes of PC-Cards, according to the
  4. #  AMU-specification
  5. #
  6. #  parameters:   $1:   Card Type: The Card Type is written as disk/volume-label
  7. #                      to the boot-record
  8. #                      The string should have a length of max. 11 characters.
  9. #
  10. #                $2:   Drive character (b:, c:)
  11. #
  12. #  10-12-2003    lct   created
  13. #
  14. vers=1.4
  15.  
  16. #echo "debug: $0,$1,$2,$3,$4"
  17.  
  18. #
  19. # main()
  20. #
  21. if [ $# -ne 2 ] ; then
  22.     echo "Usage: amuFormat.sh <Card Type> <drive>" >&2
  23.     echo "<Card Type> has to be defined in amuFormat.sh itself" >&2
  24.     echo "<drive> has to be defined in mtools.conf" >&2
  25.     exit 1
  26. fi
  27.  
  28. echo "amuFormat $vers started..."
  29.  
  30. drive="$2"
  31.  
  32. case "$1" in
  33. 8MBCARD-FW)
  34.     ## using the f: or g: drive for fat12 formatting...
  35.     ## see mtools.conf file...
  36.     case "$2" in
  37.     [bB]:) drive="f:" ;;
  38.     [cC]:) drive="g:" ;;
  39.     *) echo "Drive $2 not supported."; exit 1 ;;
  40.     esac
  41.     cylinders=245 heads=2 cluster_size=8
  42.     ;;
  43. 32MBCARD-FW)
  44.     #from amu_toolkit_0_6:
  45.     #mformat -t489 -h4 -c4 -n32 -H32 -r32 -vPC-CARD -M512 -N0000 c:
  46.     cylinders=489 heads=4 cluster_size=4
  47.     ;;
  48. 64MBCARD-FW)
  49.     echo "***** WARNING: untested on AvHMU, exiting *****"
  50.     exit 1
  51.     cylinders=245 heads=2 cluster_size=8
  52.     ;;
  53. 1GBCARD-FW)
  54.     # from amu_toolkit_0_6:
  55.     #mformat -t2327 -h16 -c64 -n63 -H63 -r32 -v AMU-CARD -M512 -N 0000 c:
  56.     echo "***** WARNING: untested on AvHMU *****"
  57.     cylinders=2327 heads=16 cluster_size=64
  58.     ;;
  59. 64MBCARDSAN)
  60.     # from amu_toolkit_0_6:
  61.     #mformat -t489 -h8 -c4 -n32 -H32 -r32 -v AMU-CARD -M512 -N 0000 c:
  62.     cylinders=489 heads=8 cluster_size=4
  63.     ;;
  64. #
  65. # insert new cards here...
  66. #
  67. *)
  68.     echo "Card not supported."
  69.     exit 1
  70.     ;;
  71. esac
  72.  
  73. echo "Formatting card in slot $2 as $1"
  74.  
  75. ## initialise partition table
  76. mpartition -I "$drive"
  77.  
  78. # write a partition table
  79. mpartition -c -t$cylinders -h$heads -s32 -b32 "$drive"
  80.  
  81. ## write boot-record, two FATs and a root-directory
  82. mformat -c$cluster_size -v "$1" "$drive"
  83.  
  84. minfo "$2"
  85. mdir  "$2"
  86.  
  87. echo "done."
  88.